import request from '/@/utils/request';
enum Api {
 
  approvalflowUploadFormFile='/api/approvalflow/UploadFormFile',
  approvalflowUDeleteFormFile='/api/approvalflow/DeleteFormFile'
}
// 删除表单文件
export const FlowDeleteFormFile = (params?: any) =>
	request({
		url: Api.approvalflowUDeleteFormFile,
		method: 'post',
		data: params,
	});
// 上传表单文件
export const FlowUploadFormFile = (params?: any) =>
{
    const formData = new window.FormData();
	formData.append('file', params.file);
	//自定义参数
	if (params.data) {
		Object.keys(params.data).forEach((key) => {
			const value = params.data![key];
			if (Array.isArray(value)) {
				value.forEach((item) => {
					formData.append(`${key}[]`, item);
				});
				return;
			}
			formData.append(key, params.data![key]);
		});
	}
	return request({
		url: Api.approvalflowUploadFormFile,
		method: 'POST',
		data: formData,
		headers: {
			'Content-type': 'multipart/form-data;charset=UTF-8',
			// ts-ignore
			ignoreCancelToken: true,
		},
	});
}
	
   
